<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 月薪 performance
        /*
        * @function 计算工资
        * @params monthSalary 月薪 数值类型number
        *  performance[S A B C D]
        * @return total number 总工资
        */

        function calculaSalory(monthsalary,level='C'){
       
        // var yearsalary=monthsalary*minth
        // if(level==A){
        //   return monthsalary*8
        // }else{
        //     return 
        // }

        // switch(level){
        //         case 'SSP':return (12+10)*monthSalary;break;
        //         case 'S': return (12+6)*monthSalary;break;
        //         case 'A': return (12+5)*monthSalary;break;
        //         case 'B': return (12+4)*monthSalary;break;
        //         case 'C': return (12+3)*monthSalary;break;
        //         case 'D': return (12+1)*monthSalary;break;
        //     }

        switch(level){
            case 'A':return performanceA(monthsalary);
            break;
            case 'B':return performanceA(monthsalary);
            break;
            case 'C':return performanceA(monthsalary);
            break;
            case 'D':return performanceA(monthsalary);
            break;
        }
        }


        // 财务执行
        // 解耦等级的工资制定
        // A等级的工资计算方式
        const performanceA=function(salary){
        return salary*(12+4)
        }
        // B等级的工资计算方式
        const performanceB=function(salary){
        return salary*(12+3)
        }
        //C等级的工资计算方式
        const performanceC=function(salary){
        return salary*(12+2)
        }
        //D等级的工资计算方式
        const performanceD=function(salary){
        return salary*(12+1)
        }
let total=calculaSalory(20000,'A');
let anothertotal=calculaSalory(7000);
console.log(total,anothertotal);    
    </script>
</body>
</html>